//
//  NewTableViewCell.m
//  网易新闻
//
//  Created by dllo on 16/6/22.
//  Copyright © 2016年 dllo. All rights reserved.
//

#import "NewTableViewCell.h"
#import "Duanzi.h"
#import "Highet.h"
@interface NewTableViewCell()

@property(nonatomic,retain)UILabel *label;

@end


@implementation NewTableViewCell
-(void)dealloc{
    [_label release];
    [super dealloc];
    
}
-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    
    self  = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        
        
        
        
        self.label = [[UILabel alloc]init];
        [self.contentView addSubview:_label];
        [_label release];
        
       }
        return  self;
    }
-(void)layoutSubviews{
    
    [super layoutSubviews];
    
    CGFloat labelHeight = [Highet heightWith:self.duanzi.digest];
    
    self.label.frame = CGRectMake(20,0, self.contentView.bounds.size.width-40, labelHeight);
    
    self.label.backgroundColor = [UIColor whiteColor];

    self.label.numberOfLines = 0;
}
-(void)setDuanzi:(Duanzi *)duanzi{
    if (_duanzi != duanzi) {
        [_duanzi release];
        _duanzi = [duanzi retain];
        
    }
    _label.text = duanzi.digest;

}






@end
